import React, { useState } from 'react';
import { Breadcrumb, Input, Button, Form, Switch, message } from 'antd';
import '../../../views/Index/Information/Information.scss'
import * as service from '../../../api/gl'

interface Props {

}

function Information(props: Props) {

    const dian = () => {
        console.log('点了');
    }
    const [list,setlist] =useState()

    const [form] = Form.useForm();

    const onFinish = async(formvalues:any)=>{
        console.log(formvalues);
        const res = await service.information_list({name:formvalues.name,weixin:formvalues.weixin,phone:formvalues.phone,QQ:formvalues.QQ,emil:formvalues.emil,zhanghu:formvalues.zhanghu,password:formvalues.password,passworddd:formvalues.passworddd})
        if(res.status == 201){
            message.success('添加成功')
        }else{
            message.error('添加失败')
        }
    }



    return (
        <div className='information'>
            <div className="one">
                <Breadcrumb>
                    <Breadcrumb.Item>
                        <a href="">设置</a>
                    </Breadcrumb.Item>
                    <Breadcrumb.Item>
                        <a href="">添加账号</a>
                    </Breadcrumb.Item>
                </Breadcrumb>
                <p>添加账号</p>
            </div>
            <span className='aa'>个人信息</span>
            <div className="two">
                <div className="two1">
                    <Form
                        form={form}
                        onFinish={onFinish}
                    >
                        <Form.Item
                            name="name"
                            label="姓名"
                            rules={[{ required: true, message: '请输入' }]}
                        >
                            <Input placeholder="请输入" />
                        </Form.Item>
                        <Form.Item
                            name="weixin"
                            label="微信"
                        >
                            <Input placeholder="请输入" />
                        </Form.Item>
                        <Form.Item
                            name="phone"
                            label="电话"
                            rules={[{ required: true, message: '请输入' }]}
                        >
                            <Input placeholder="请输入" />
                        </Form.Item>
                        <Form.Item
                            name="QQ"
                            label="QQ"
                        >
                            <Input placeholder="请输入" />
                        </Form.Item>
                        <Form.Item
                            name="emil"
                            label="邮箱"
                        >
                            <Input placeholder="请输入" />
                        </Form.Item>
                    </Form>
                </div>
            </div>
            <span className='aa'>账户信息</span>
            <div className="three">
                <div className="three1">
                    <Form
                        form={form}
                        onFinish={onFinish}
                    >
                        <Form.Item
                            name="zhanghu"
                            label="账户"
                            rules={[{ required: true, message: '请输入账户名' }]}
                        >
                            <Input placeholder="请输入" />
                        </Form.Item>
                        <Form.Item
                            name="password"
                            label="密码"
                            rules={[{ required: true, message: '请输入密码' }]}
                        >
                            <Input className='a2' placeholder="请输入密码" />
                        </Form.Item>
                        <Form.Item
                            name="passworddd"
                            label="确认密码"
                            rules={[{ required: true, message: '请输入确认密码' }]}
                        >
                            <Input placeholder="请输入" />
                        </Form.Item>
                        <Button type="primary" htmlType="submit">提交</Button>
                    </Form>
                </div>
            </div>
        </div>
    );
}

export default Information;